package cn.ym.basic.controller;

import cn.ym.basic.exception.BusinessException;
import cn.ym.basic.service.IVerifyService;
import cn.ym.basic.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 验证码接口
 * 1.图形验证码接口
 * 2.手机验证码接口
 */
@RestController
@RequestMapping("/verifyCode")
public class VerifyCodeController {

    @Autowired
    private IVerifyService verifyService;
    /**
     * 接口：图形验证码
     * @param key
     * @return
     */
    @GetMapping("/image/{key}")
    public AjaxResult getImageCode(@PathVariable("key") String key){

        return verifyService.getImageCode(key);
    }

    /**
     * 接口：手机短信验证码
     * @param
     * @return
     */
    @PostMapping("/smsCode")
    public AjaxResult smsCode(@RequestBody Map<String,String> map){

        return verifyService.smsCode(map);
    }


    /**
     * 接口：wx登录绑定---短信验证码
     * @param
     * @return
     */
    @PostMapping("/binderSmsCode")
    public AjaxResult binderSmsCode(@RequestBody Map<String,String> map){

        return verifyService.binderSmsCode(map);
    }

}
